package vn.com.hoasua.database.sobject;

import vn.com.hoasua.database.adbException;
import vn.com.hoasua.database.adbObject;

@SuppressWarnings("serial")
public class LogDb extends adbObject{
	public static final String CLASS_UNIQUE="LogDb";
	public static final int NUM_FIELDS=5;
	
	public String clzz="";
	public String method = "";
	public int line = 0;
	public String message="";
	public long time=0;
	
	public LogDb(int index, String... values) {
		super(index, values);
		
		try {
			if (values.length != NUM_FIELDS)
				throw new adbException(CLASS_UNIQUE+" length values invalid!");
		} catch (adbException e) {
			e.printStackTrace();
		}
		this.clzz = values[0];
		this.method = values[1];
		try{
			line=Integer.parseInt(values[2]);
		}catch(NumberFormatException e){
			line = -1;
		}
		this.message = values[3];
		try{
			time=Long.parseLong(values[4]);
		}catch(NumberFormatException e){
			time = 0;
		}
	}
	@Override
	public String[] getValues() {
		values[0]=this.clzz;
		values[1]=this.method;
		values[2]=this.line+"";
		values[3]=this.message;
		values[4]=time+"";
		return values;
	}
}
